package com.aya.transaction.service;

import com.aya.transaction.entity.Blog;
import com.aya.transaction.mapper.BlogMapper;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class BlogThreadTransactionService {
    @Resource
    BlogMapper blogMapper;

    @Async
    @Transactional
    public void updateById(String id, String content) {
        Blog blog = selectByPrimaryKey("1");
        System.out.println("child1 blog:" + blog);
        blogMapper.updateById(id, content);
    }


    public Blog selectByPrimaryKey(String id) {
        return blogMapper.selectTransBlog(id);
    }
}
